package com.wj.ballcat.admin.config;

import com.wj.ballcat.admin.filter.CustomHeaderFilter;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;

/**
 * @author WJ
 */
@AutoConfiguration
@ConditionalOnWebApplication
public class MyFilterConfiguration {

	@Bean
	public FilterRegistrationBean<CustomHeaderFilter> myFilterBean(){
		FilterRegistrationBean<CustomHeaderFilter> registration = new FilterRegistrationBean<>(new CustomHeaderFilter());
		registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
		return registration;
	}
}
